# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     day130_pyqt5_signal_slot
   Description :
   Author :       fuml
   date：          2019/9/21
-------------------------------------------------
   Change Activity:
                   2019/9/21:In this example, we connect a signal
of a QSlider to a slot of a QLCDNumber.
-------------------------------------------------
"""
import sys
from  PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QMainWindow,QTextEdit,QAction,\
            QLCDNumber,QSlider,QVBoxLayout,QHBoxLayout,QWidget,QApplication,QStatusBar,QMenu,QMenuBar,QToolBar)
from PyQt5.QtGui import QIcon

class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        lcd:QLCDNumber = QLCDNumber(self)
        sld:QSlider= QSlider(Qt.Horizontal,self)
        sld.setMinimum(0)
        sld.setMaximum(100)
        lcd.display(sld.minimum())

        vbox= QVBoxLayout()
        vbox.addWidget(lcd)
        vbox.addWidget(sld)

        self.setLayout(vbox)

        sld.valueChanged.connect(lcd.display)

        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle('Signal & Slot')
        self.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())
